#ifndef _WEBSOCKET_PROTOCOL_H_
#define _WEBSOCKET_PROTOCOL_H_


#include <web_socket.h>
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>

#define WEBSOCKET_PROTOCOL_SERVER_HELLO_EVENT (1 << 0)

class WebsocketProtocol {
public:
    WebsocketProtocol();
    ~WebsocketProtocol();

    void SendAudio(const std::vector<uint8_t>& data);
    bool OpenAudioChannel();
    void CloseAudioChannel();
    bool IsAudioChannelOpened() const;

private:
    EventGroupHandle_t event_group_handle_;
    WebSocket* websocket_ = nullptr;

    void SendText(const std::string& text);
};

#endif
